<template>
  <div class="body">
    <headerView ref="header" systemName="赵县中医院OA系统" />
    <el-container>
      <leftView ref="leftView" />
      <div class="main_box">
        <headerNav ref="headerNav" />
        <keep-alive>
          <router-view :key="$route.name"></router-view>
        </keep-alive>
      </div>
    </el-container>
  </div>
</template>
<script>
import headerView from "@/components/header.vue";
import leftView from "@/components/assets/leftAssetsMenu.vue";
import headerNav from "@/components/headerNav.vue";
import { mapState } from 'vuex';

export default {
  name: "Index",
  components: {
    headerView,
    leftView, headerNav,
  },
  data() {
    return {
      navFlag: false,
    };
  },
  computed: {
    ...mapState(['navMenuList']),
    navFlag() {
      const arr = this.navMenuList.filter(item => item.id == 0)
      if (arr.length == 1) {
        return true
      } else {
        return false
      }
    },
  },
  mounted() {
    console.log(123, this.$route);
    console.log("navFlag", this.navFlag);
    // this.$refs.header.systemName="赵县中医院OA系统";
    this.$refs.header.homeIndexName = "AssetsMainView";

  },
  beforeDestroy() {
    window.removeEventListener('beforeunload', this.handleBeforeUnload);
  },
  methods: {
    openOrClose() {
      this.$refs.leftView.openOrClose()
    },
    // handleBeforeUnload(event) {

    //   alert('确定要离开当前页面吗？')
    //   event.returnValue = confirmationMessage; 
    // }

  },
};
</script>
<style scoped>
.body {
  background: white;
}

.main_box {
  width: 89%;
  flex: 1;
  display: flex;
  flex-direction: column;
}
</style>